package weaver.interfaces.zlldjcws.util;

import javax.servlet.ServletConfig;

import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.frontend.ServerFactoryBean;
import org.apache.cxf.transport.servlet.CXFNonSpringServlet;
import weaver.interfaces.zlldjcws.cgdd.service.LdCgddService;
import weaver.interfaces.zlldjcws.cgdd.service.impl.LdCgddServiceImpl;
import weaver.interfaces.zlldjcws.cgsh.service.LdCgshService;
import weaver.interfaces.zlldjcws.cgsh.service.impl.LdCgshServiceImpl;
import weaver.interfaces.zlldjcws.cgxxjl.service.LdCgxxService;
import weaver.interfaces.zlldjcws.cgxxjl.service.impl.LdCgxxServiceImpl;
import weaver.interfaces.zlldjcws.kjkm.service.LdKjkmService;
import weaver.interfaces.zlldjcws.kjkm.service.impl.LdKjkmServiceImpl;

public class WebServlet extends CXFNonSpringServlet {
	private static final long serialVersionUID = 1L;
	  
    @Override  
    protected void loadBus(ServletConfig servletConfig) {  
        super.loadBus(servletConfig);  
        
        Bus bus = getBus();  
        BusFactory.setDefaultBus(bus);

        LdCgddServiceImpl lCgddServiceImpl = new LdCgddServiceImpl();//实现类
        ServerFactoryBean serverFactoryBean1 = new ServerFactoryBean(); //server工厂
        serverFactoryBean1.setServiceClass(LdCgddService.class);// 接口类
        serverFactoryBean1.setAddress("/lcgddService"); //服务请求路径
        serverFactoryBean1.setServiceBean(lCgddServiceImpl);
        serverFactoryBean1.create();

        LdCgshServiceImpl ldCgshServiceImpl = new LdCgshServiceImpl();//实现类
        ServerFactoryBean serverFactoryBean2 = new ServerFactoryBean(); //server工厂
        serverFactoryBean2.setServiceClass(LdCgshService.class);// 接口类
        serverFactoryBean2.setAddress("/ldcgshService"); //服务请求路径
        serverFactoryBean2.setServiceBean(ldCgshServiceImpl);
        serverFactoryBean2.create();

        LdCgxxServiceImpl ldCgxxServiceImpl = new LdCgxxServiceImpl();
        ServerFactoryBean serverFactoryBean3 = new ServerFactoryBean(); //server工厂
        serverFactoryBean3.setServiceClass(LdCgxxService.class);// 接口类
        serverFactoryBean3.setAddress("/ldcgxxService"); //服务请求路径
        serverFactoryBean3.setServiceBean(ldCgxxServiceImpl);
        serverFactoryBean3.create();


        LdKjkmServiceImpl ldKjkmServiceImpl = new LdKjkmServiceImpl();
        ServerFactoryBean serverFactoryBean4 = new ServerFactoryBean(); //server工厂
        serverFactoryBean4.setServiceClass(LdKjkmService.class);// 接口类
        serverFactoryBean4.setAddress("/ldkjkmService"); //服务请求路径
        serverFactoryBean4.setServiceBean(ldKjkmServiceImpl);
        serverFactoryBean4.create();
    }  
}